package cn.chenfei.sshd.client.common;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum DirEnum {

    FILE(1, '-', "文件"),
    DIRECTORY(2, 'd', "文件夹"),
    LINK(3, 'l', "符号链接"),
    UNKNOWN(-1, 'd', "未知");

    DirEnum(int value, char prefix, String describe) {
        this.value = value;
        this.prefix = prefix;
        this.describe = describe;
    }

    final int value;

    final char prefix;

    final String describe;

    public static DirEnum getByType(int type) {
        return Arrays.stream(values()).filter(v -> v.value == type).findFirst().orElse(DirEnum.UNKNOWN);
    }
}
